package com.example.code.juc;

public enum CountryEnum {
    ONE(1, "齐"),
    TWO(2, "楚"),
    THREE(3, "燕"),
    FORE(4, "赵"),
    FIVE(5, "韩"),
    SIX(6, "魏");

    private Integer code;
    private String message;

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    CountryEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static CountryEnum foreachCountryEnum(Integer code) {
        CountryEnum[] countryEnums = CountryEnum.values();

        for (CountryEnum countryEnum : countryEnums) {
            if (code == countryEnum.code) {
                return countryEnum;
            }
        }
        return null;
    }

}
